package com.wpp.serializer;

import com.alibaba.fastjson.JSON;

/**
 * @author by wpp25
 * @Classname JSONSerializer
 * @Description
 * @Date 2020/11/26 20:04
 */
public class JSONSerializer implements Serializer {
    @Override
    public byte[] serialize(Object object) throws Exception {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) throws Exception {
        return JSON.parseObject(bytes,clazz);
    }
}
